from langchain_chroma import Chroma

from base import embeddings
from demo03.BilibiliVideoToVectorStore import vector_store_dir

print(vector_store_dir)
#加载本地向量数据库
vectorStore = Chroma(
    #本地向量库目录
    persist_directory=vector_store_dir,
    #使用同一个embeddings
    embedding_function=embeddings
)

#直接检索试试
result = vectorStore.similarity_search_with_score(
    "如何使用ChatGLM+Langchain构建本地知识库构建本地知识库",
)
print(result[0])